Randomized Algorithms: QuickSort and QuickSelect
ثبت نشده
چکیده
Let Q(A) be number of comparisons done on input array A: (A) For 1 ≤ i < j < n let R ij be the event that rank i element is compared with rank j element. (B) X ij is the indicator random variable for R ij. That is, X ij = 1 if rank i is compared with rank j element, otherwise 0. Q(A) = ∑ 1≤i<j≤n X ij and hence by linearity of expectation,
منابع مشابه
Introduction to Randomized Algorithms: QuickSort and QuickSelect
QuickSort Hoare [1962] (A) Pick a pivot element from array (B) Split array into 3 subarrays: those smaller than pivot, those larger than pivot, and the pivot itself. (C) Recursively sort the subarrays, and concatenate them. Randomized QuickSort (A) Pick a pivot element uniformly at random from the array (B) Split array into 3 subarrays: those smaller than pivot, those larger than pivot, and the...
متن کاملIntroduction to Randomized Algorithms: QuickSort and QuickSelect
QuickSort Hoare [1962] (A) Pick a pivot element from array (B) Split array into 3 subarrays: those smaller than pivot, those larger than pivot, and the pivot itself. (C) Recursively sort the subarrays, and concatenate them. Randomized QuickSort (A) Pick a pivot element uniformly at random from the array (B) Split array into 3 subarrays: those smaller than pivot, those larger than pivot, and the...
متن کاملRandomized Algorithms: QuickSort and QuickSelect
(A) Let Q(A) be number of comparisons done on input array A: (A) R ij : event that rank i element is compared with rank j element, for 1 ≤ i < j ≤ n. (B) X ij is the indicator random variable for R ij. That is, X ij = 1 if rank i is compared with rank j element, otherwise 0. (B) Q(A) = ∑ 1≤i<j≤n X ij. (C) By linearity of expectation,
متن کاملRandomized Algorithms: QuickSort and QuickSelect
Let Q(A) be number of comparisons done on input array A: (A) For 1 ≤ i < j < n let R ij be the event that rank i element is compared with rank j element. (B) X ij is the indicator random variable for R ij. That is, X ij = 1 if rank i is compared with rank j element, otherwise 0. Q(A) = ∑ 1≤i<j≤n X ij and hence by linearity of expectation,
متن کامل